home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Online / Epic4 / share / epic / help / 6_functions / splice < prev    next >
Text File  |  2001-03-21  |  1KB  |  30 lines

  1. Synopsis:
  2.    $splice(<variable name> <index> <count> [<text>])
  3.  
  4. Technical:
  5.    This function removes words from within a string, and then optionally
  6.    replace them with something else.  It requires that a variable name be
  7.    given, not an actual variable (meaning the '$' is omitted).  If no
  8.    replacement text is given, the words are simply removed.  The index
  9.    counts from zero.
  10.  
  11. Practical:
  12.    This function is useful for changing parts of a string without
  13.    rewriting the whole thing.  Used in conjunction with the matching
  14.    functions, it can serve as a search-and-replace function that operates
  15.    on whole words ($sar() operates on individual characters).
  16.  
  17. Returns:
  18.    text removed from string
  19.  
  20. Examples:
  21.    @ foo = [one two three four five]
  22.    $splice(foo 1 3 foo bar blah)       returns "two three four"
  23.    $splice(foo 0 2)                    returns "one foo"
  24.    $splice(foo 2 1)                    returns "five"
  25.    echo $foo                           shows "bar blah", end result
  26.  
  27. See Also:
  28.    sar(6)
  29.  
  30.